<template>
    <div>
    <el-row class="tac">
     <el-col :span="24">
     <el-menu
      default-active="1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose">
      <el-menu-item index="1" @click="clickMenu('index')">
        <i class="el-icon-menu"></i>
        <span slot="title">首页</span>
      </el-menu-item>
       <el-menu-item index="4" @click="clickMenu('waring')">
        <i class="el-icon-document"></i>
        <span slot="title">警报管理</span>
      </el-menu-item>
      <el-menu-item index="3" @click="clickMenu('green-land')">
        <i class="el-icon-menu"></i>
        <span slot="title">绿地管理</span>
      </el-menu-item>
      <el-menu-item index="2" @click="clickMenu('user')">
        <i class="el-icon-location"></i>
          <span>用户管理</span>
      </el-menu-item>
      <el-menu-item index="5" @click="clickMenu('setting')">
        <i class="el-icon-setting"></i>
        <span slot="title">设置</span>
      </el-menu-item>
    </el-menu>
  </el-col>
        </el-row>
    </div>
</template>

<script>
export default {
    name: 'HomeMenu',

    data() {
        return {
            
        };
    },

    mounted() {
        this.clickMenu('index')
    },

    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      clickMenu(index){
          switch(index){
            case "index":
                this.$router.push('/home/index')
                break
            case "user":
                this.$router.push('/home/user')
                break
            case "green-land":
                this.$router.push('/home/greenLand')
                break
            case "waring":
                this.$router.push('/home/waring')
                break
            case "setting":
                this.$router.push('/home/setting')
                break
          }
     
      }
    },
};
</script>

<style scoped>

</style>